﻿namespace LocalNas.Application.Service.Wallhaven.Dto;
public class SearchResult
{
    public int TotalItems { get; set; }
    public int TotalPage { get; set; }
    public List<SearchResultItem> Items { get; set; }

    public class SearchResultItem
    {
        public string Href { get; set; }
        public string Cover { get; set; }
        public string Title { get; set; }
        public string Suffix { get; set; }

        public string Image
        {
            get
            {
                //https://wallhaven.cc/w/p93gm9 
                //https://w.wallhaven.cc/full/p9/wallhaven-p93gm9.jpg
                var t = new Regex("(?<=w/).*?$").Match(Href).Value;
                return $"https://w.wallhaven.cc/full/{t.Substring(0, 2)}/wallhaven-{t}.{Suffix}";
            }
        }
    }
}
